/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.behavioral.memento;

/**
 *
 * @author jmg
 */
public class Main {
    
    public static void main(String[] args) {
        
        CareTaker careTaker = new CareTaker();
        
        Persona p = new Persona();
        p.setApellido("peres");
        p.setNombre("juan");
        
        careTaker.addMemento(p.saveState());
        
        p.setNombre("coco");
        
        careTaker.addMemento(p.saveState());
        
        
        p.setApellido("sanchez");
        
        System.out.println(p);
        
        p.restoreState(careTaker.getMemento(0));
        
        System.out.println(p);
        
        p.restoreState(careTaker.getMemento(1));
        
        System.out.println(p);
        
    }
}


